package algorithms.leecode;

public class Au129 {


      public class TreeNode {
          int val;
          TreeNode left;
         TreeNode right;
          TreeNode() {}
          TreeNode(int val) { this.val = val; }
          TreeNode(int val, TreeNode left, TreeNode right) {
              this.val = val;
              this.left = left;
              this.right = right;
          }
      }

    public static void main(String[] args) {

    }
    int sum = 0;

    public void dfs(TreeNode root,int dSum) {
        if (root.left != null || root.right != null) {
            dSum += root.val;
        }
        if (root.left != null) {
            dfs(root.left,dSum * 10);
        }
        if (root.right != null) {
            dfs(root.right,dSum * 10);
        }
        // 集美做节点又没又节点
        sum += dSum + root.val;

    }
}
